<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>@ViewBag.Title</title>
<link rel="Stylesheet" type="text/css"
	href='${pageContext.request.contextPath}/Content/blogManager.css' />
<script type="text/javascript"
	src="${pageContext.request.contextPath }/script/jquery-1.10.2.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/script/jquery.validate.js"></script>
<script type="text/javascript">
	$(function() {
		$("#form").validate({
			rules : {
				"album.name" : {
					required : true
				},
				"album.description" : {
					required : true
				}
			},
			messages : {
				"album.name" : {
					required : "请输入相册名字"
				},
				"album.description" : {
					required : "请输入相册描述"
				}
			}
		});
		
	});
</script>
<style type="text/css">
#main h3 {
	text-indent: 3em;
	background: url('Content/images/ihome-main-bg.gif') repeat-x;
	padding: 5px 0px;
}

label.error {
	color: red;
	margin-left: 10px;
}

#main dl {
	width: 200px;
	margin: 15px 30px;
	float: left;
}

#main dd {
	text-align: center;
}

#addAlbum table {
	margin: 10px 40px;
}

#addAlbum table td {
	padding-bottom: 10px;
	padding-right: 10px;
}

#info dt img {
	width: 200px;
	height: 150px;
}

/* #info dt {
	width: 200px;
	height: 150px;
}

#info dt img {
	width: 200px;
	height: 150px;
} */
</style>
</head>
<body>
	<div id="wrapper">
		<s:action name="backHeader" namespace="/" executeResult="true"></s:action>
		<div id="content">
			<s:action name="backSidebar" namespace="/" executeResult="true"></s:action>
			<div id="main">
				<c:if test="${albumId > 0 }">
					<s:action name="photoPage" namespace="/" executeResult="true"></s:action>
				</c:if>
				<c:if test="${albumId < 1 }">
					<div id="info">
						<h3>我的相册</h3>
						<c:forEach items="${albumList }" var="a">
							<dl>
								<dt>
									<c:if test="${ not empty a.cover}">
										<a href="albumManage?albumId=${a.id }"> <img
											src="${pageContext.request.contextPath }/UserFiles/Albums/${a.user.id }/${a.id }/Thumbnail/${a.cover}" />
										</a>
									</c:if>

									<c:if test="${empty a.cover }">
										<a href="albumManage?albumId=${a.id }"> <img
											src="${pageContext.request.contextPath }/UserFiles/Albums/emptyAlbum.jpg" />
										</a>
									</c:if>
								</dt>
								<dd>
									<a href="albumManage?albumId=${a.id }">${a.name }</a>
								</dd>
							</dl>
						</c:forEach>
					</div>
					<div class="clearBoth"></div>

					<div id="addAlbum">
						<h3>创建相册</h3>
						<form action="addAlbum" id="form" method="post"
							enctype="multipart/form-data">
							<table>
								<tr>
									<td>相册名称：</td>
									<td><input type="text" name="album.name" /></td>
								</tr>
								<tr>
									<td>相册描述：</td>
									<td><textarea rows="5" cols="30" name="album.description"></textarea></td>
								</tr>
								<tr>
									<td>相册封面：</td>
									<td><input type="file" name="cover" /></td>
								</tr>
								<tr>
									<td></td>
									<td><input type="submit" value="创建相册" /></td>
								</tr>
							</table>
						</form>
					</div>
				</c:if>
			</div>
			<div class="clearBoth"></div>

		</div>
		<%@include file="../shared/footer.jsp"%>

	</div>
</body>
</html>